// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'

// 引入ELEMENT 并设置中文语言
import ElementUI from 'element-ui'
import locale from 'element-ui/lib/locale/lang/zh-CN'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI, { locale })

// 引入cookies  使用方法为:this.$cookie
import Cookies from "js-cookie";
Vue.prototype.$cookie = Cookies

// 引入公共样式库
import '../static/common.css'
import '../static/iconfont/iconfont.css'

//全局注册，使用方法为:this.$axios
import axios from 'axios'
Vue.prototype.$axios = axios
axios.defaults.baseURL="http://192.168.0.102:9991"
// axios.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8'
axios.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'
// 引入全局配置
import config from '../src/utils/config'
Vue.prototype.$config = config.data

// 引入公共方法，使用方法为:this.$filter
import filter from '../src/utils/filter'
Vue.prototype.$filter = filter

// 引入路由标题控制
import router from './router'
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
})
